package panel

type Common struct {
    Parental Type
    Lines, Cols int
    LineOffset, ColOffset int
}

func (c *Common) Parent(p Type) {
    c.Parental = p
}

func (c *Common) Resize(lines, cols int, lineOffset, colOffset int) {
    c.Lines, c.Cols = lines, cols
    c.LineOffset, c.ColOffset = lineOffset, colOffset
}

func (c *Common) Cursor(line, col int) {
    c.Parental.Cursor(line + c.LineOffset, col + c.ColOffset) 
}

func (c *Common) Put(line, col int, rune int) {
    c.Parental.Put(line + c.LineOffset, col + c.ColOffset, rune)
}

func (c *Common) PutString(line, col int, text string) {
    c.Parental.PutString(line + c.LineOffset, col + c.ColOffset, text)
}

func (c *Common) FocusForClick(line, col int) Type {
    return c
}

func (c *Common) Refresh() {
	Log("Common.Refresh")
}

func (c *Common) Key(run int) Type {
	return c
}

func (c *Common) Focus() {
}

func (c *Common) Box(line, col int, oline, ocol int) {
	loff, coff := c.LineOffset, c.ColOffset
	c.Parental.Box(line + loff, col + loff, oline + loff, ocol + coff)
}

func (c *Common) Show(message string) {
	c.Parental.Show(message)
}
